package com.xtaller.sdboot.utils.captcha.utils;

import java.util.Random;

/**
 * @version V1.0
 * @author: Taller
 * @date: 2019-06-17
 * @Description:
 */
public class EnumUtils {
    private static Random rand = new Random();

    private EnumUtils() {
    }

    public static <T extends Enum<T>> T random(Class<T> ec) {
        return random(ec.getEnumConstants());
    }

    public static <T> T random(T[] values) {
        return values[rand.nextInt(values.length)];
    }
}
